package com.sci.controller;

import com.sci.entity.Food;
import com.sci.service.FoodService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/food")
public class FoodController {
    @Resource
    private FoodService foodService;

    @GetMapping("/business/{businessId}")
    public List<Food> getFoodByBusinessId(@PathVariable(name = "businessId") String businessId) {
        return foodService.getFoodByBusinessId(businessId);
    }

    @GetMapping("/{foodId}")
    public Food getFoodById(@PathVariable(name = "foodId") Integer foodId) {
        return foodService.getFoodById(foodId);
    }

}
